#!/usr/bin/env python
"""------------------------------
" Filename:     ProcessQueueTest.py
" Description:  Testing environment for the Process Queue Manager
" Group 3:      nachOS
" 
" Author(s):    Jan Durakiewicz
"
" Class:        CSE 325
" Instructor:   David Duggan
" Assignment:   Lab #1 Queue Manager
" Assigned:     January 22, 2013
" Due:          January 29, 2013
------------------------------"""

import ctypes
import TestFunctions

#Holds the ProcessManager C library
ProcessQueue = ctypes.CDLL('./ProcessQueue.so')

#Loop forever waiting for commands and running their associated functions
while 1:
    inputStr = raw_input(">")
    inputArr = inputStr.split()
    
    if inputArr[0] == "init_Q":
        TestFunctions.init_Q(ProcessQueue)
    
    elif inputArr[0] == "list":
        TestFunctions.list(ProcessQueue)

    elif inputArr[0] == "enqueue":
        TestFunctions.enqueue(ProcessQueue, int(inputArr[1]), 
                              int(inputArr[2]), int(inputArr[3]),
                              int(inputArr[4]), int(inputArr[5]),
                              int(inputArr[6]))

    elif inputArr[0] == "dequeue":
        TestFunctions.dequeue(ProcessQueue) 
    
    elif inputArr[0] == "delete":
        TestFunctions.delete(ProcessQueue, int(inputArr[1]))

    elif inputArr[0] == "quit":
        break 
    
    else:
        print "INVALID COMMAND" 
